<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<nav id="top" class="navbar navbar-inverse" th:fragment="m_topbar">
    <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand" href="#">美食分享平台</a>
        </div>
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li><a href="/foodshare/main/index">首页</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">美食资讯 <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="/foodshare/main/lately#news">最新资讯</a></li>
                        <li><a href="/foodshare/main/index#news">热点资讯</a></li>
                        <li><a href="/foodshare/main/news">更多资讯</a></li>
                    </ul>
                </li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">美食分类 <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li th:each="cate:${category}" th:if="${cate.status} eq 1 "><a th:text="${cate.categoryName}"
                                                          th:href="@{/main/index/}+${cate.categoryId}+'#food'"></a></li>
                    </ul>
                </li>
            </ul>
            <form name="search" class="navbar-form navbar-left" action="/foodshare/main/search" method="post">
                <div class="input-group">
                    <input type="text" name="keyword" class="form-control" placeholder="关键字">
                    <span class="input-group-btn">
						<button class="btn btn-default" type="submit">
							<img height="18" width="18" th:src="@{/main/img/search.svg}">
						</button>
					</span>
                </div>
                <a style="margin-left: 20px" href="/foodshare/main/publish"  class="btn btn-primary">发布</a>
            </form>
            <ul class="nav navbar-nav navbar-right">
                <li>
                    <img th:if="${user.username eq 'nobody' or (#strings.isEmpty(user.head))}" id="user_head" class="img-rounded"
                         th:src="@{/main/img/head.jpg}"
                         style="width: 30px">
                    <img style="position: absolute;width: 30px;top: 10px;right: 10px;margin: auto;" class="img-rounded"
                         th:src="${user.head}">
                </li>
                <li class="dropdown">
                    <a th:if="${user.username} eq 'nobody'" href="#" class="dropdown-toggle" data-toggle="dropdown"
                       role="button" aria-haspopup="true" aria-expanded="false">没有登录 <span class="caret"></span></a>
                    <a th:if="${user.username} ne 'nobody'" href="#" class="dropdown-toggle" data-toggle="dropdown"
                       role="button" aria-haspopup="true" aria-expanded="false">
                        <span th:text="${user.username}"></span>
                        <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li th:if="${user.role}==0"><a href="/foodshare/back/index">后台管理系统</a></li>
                        <li th:if="${user.username} eq 'nobody'"><a href="/foodshare/user/ordinary">用户登录</a></li>
                        <li th:if="${user.username} eq 'nobody'"><a href="/foodshare/user/signUp">用户注册</a></li>
                        <li th:if="${user.username} ne 'nobody'"><a th:href="'/foodshare/main/personal/'+${user.userId}">个人中心</a></li>
                        <li th:if="${user.username} ne 'nobody'"><a href="/foodshare/collect/list">我的收藏</a></li>
                        <li th:if="${user.username} ne 'nobody'"><a href="/foodshare/main/setAccount">账号设置</a></li>
                        <li th:if="${user.username} ne 'nobody'"><a href="/foodshare/main/logout">退出</a></li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
</nav>
</body>
</html>